package Thread;
import jdk.swing.interop.SwingInterOpUtils;
//线程打断
public class Demo7 {
    public static boolean  flag=false;
    public static void main(String[] args) throws InterruptedException {
        Thread t=new Thread(()->{
            while (!flag){
                System.out.println("t进程");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println("工作完毕");
        });
        t.start();
        Thread.sleep(5000);
        flag=true;
        System.out.println("打断进程");
    }



}
